﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using PowerCreator.LMS.Common.Script;

public partial class sysadmin_UserInfo_System_Defoult : PowerCreator.LMS.Web.Base.BasePage
{
    PowerCreator.LMS.Web.User.User opUser = new PowerCreator.LMS.Web.User.User();
    PowerCreator.LMS.Web.Project.Project opProject = new PowerCreator.LMS.Web.Project.Project();
    PowerCreator.LMS.Web.Course.Course opCourse = new PowerCreator.LMS.Web.Course.Course();
    PowerCreator.LMS.Web.Course.Resource opResource = new PowerCreator.LMS.Web.Course.Resource();
    PowerCreator.LMS.Web.Project.ProjectUser opProjectUser = new PowerCreator.LMS.Web.Project.ProjectUser();
    PowerCreator.LMS.Web.Paper.ManagerPaper opPaper = new PowerCreator.LMS.Web.Paper.ManagerPaper();
    PowerCreator.LMS.Web.CMS.New opNews = new PowerCreator.LMS.Web.CMS.New();
    PowerCreator.LMS.Web.Download.Download opDownload = new PowerCreator.LMS.Web.Download.Download();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            InitPage();
            BinderPG();
        }
    }
    protected override void InitPage()
    {
        lbl_WebTitle.Text = string.Format(GetLanageValueByKey("WebTitle", PowerCreator.LMS.Language.LanagetItemType.WebTitle), GetLoginEntity.RealName);
                        
        base.InitPage();
    }
    private void BinderPG()
    {
        //PowerCreator.LMS.Web.User.LoginEntity login = GetLoginEntity;   
        //if(login != null)
        //{
        //    lab_LastLoginDate.Text = login.VOUser.UserLastLoginTime.ToString();
        //    lab_LoginCount.Text = login.VOUser.UserTotalLoginNum.ToString();       
        //    lab_RealName.Text = login.AccountInfo.RealName;
        //    lab_UserType.Text = login.RoleList;
        //    lab_UserName.Text = login.VOUser.UserName;
        //    lab_UserType.Text = login.RoleList;
        //}
        string search = "";
        lbl_UserCount.Text = opUser.Count(search).ToString();
        search = "UserIscheck = 0 ";
        lbl_UserIsCheck0.Text = opUser.Count(search).ToString();
        search = "UserIscheck = 2 ";
        lbl_UserIsCheck2.Text = opUser.Count(search).ToString();
        lbl_CurrentUserCount.Text = opUser.QueryCurrentOnlineUser().ToString();
        search = "";
        lab_LoginCount.Text = opUser.QueryOnlineUserCount(search).ToString();
        search = "";
        lbl_ProjectCount.Text = opProject.QueryTrainProjectCount(search).ToString();
        lbl_ProjectClassCount.Text = opProjectUser.QueryProjectClassCount(search).ToString();
        lbl_CourseCount.Text = opCourse.QueryCourseCount(search).ToString();
        lbl_ResourceCount.Text = opResource.QueryResourceCount(search).ToString();
        lbl_PaperCount.Text = opPaper.CountPaper(search).ToString();

        search = "";
        lbl_NewsCount.Text = opNews.Count(search).ToString();
        search = " NewState = 1";
        lbl_NewsNoCount.Text = opNews.Count(search).ToString();
                   
        search = "";
        lbl_DownloadCount.Text = opDownload.Count(search).ToString();
        search = "DownState = 1";
        lbl_DownloadNoCount.Text = opDownload.Count(search).ToString();

    }
 
    protected void btn_ClearUserInfo_ServerClick(object sender, EventArgs e)
    {
        Script.RedirectNewUrl(PowerCreator.LMS.Common.Utils.WebUtils.WebRoot + "/sysadmin/login.aspx");
    }
}
